package com.wowoai.user.service.impl;

import com.wowoai.common.page.Pagination;
import com.wowoai.common.userInfo.UserInfo;
import com.wowoai.user.controller.req.OptionTypeLogReqVO;
import com.wowoai.user.convert.ScoreOptionLogConvert;
import com.wowoai.user.entity.ScoreOptionLogEntity;
import com.wowoai.user.repository.ScoreOptionLogRepositoryI;
import com.wowoai.user.service.ScoreOptionLogServiceI;
import com.wowoai.user.service.dto.OptionTypeLogPageDTO;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

@Service
public class ScoreOptionLogServiceImpl implements ScoreOptionLogServiceI {

    private final ScoreOptionLogRepositoryI scoreOptionLogRepositoryI;

    public ScoreOptionLogServiceImpl(ScoreOptionLogRepositoryI scoreOptionLogRepositoryI){
        Assert.notNull(scoreOptionLogRepositoryI,"scoreOptionLogRepositoryI 不能为空");
        this.scoreOptionLogRepositoryI = scoreOptionLogRepositoryI;
    }

    @Override
    public ScoreOptionLogEntity save(ScoreOptionLogEntity scoreOptionLogEntity) {
        return null;
    }

    @Override
    public Pagination<OptionTypeLogPageDTO> getOptionTypeLogPage(OptionTypeLogReqVO reqVO, UserInfo userInfo) {
       Pagination<ScoreOptionLogEntity> pagination = scoreOptionLogRepositoryI.getOptionLogPage(reqVO.getPageNum(),reqVO.getPageSize(),userInfo.getPhoneNumber());

       return pagination.map(ScoreOptionLogConvert.INS::entity2DTO);
    }
}
